<?
require 'global.php';

$gee=$article;
$cate=$article_category;
$faq=new DB(Tfaq,$conn);
$faq_cate=new DB(Tfaq_category,$conn);

$url='helps';
$do=isset($_GET["do"])?clean($_GET["do"]):'view'; // 备用字段
$id=0; if (isset($_GET["id"])) $id = clean($_GET["id"]);
$page=1; if(isset($_GET["page"]))if(is_numeric($_GET["page"]))$page=$_GET["page"];
$cateid=1; if(isset($_GET["cateid"]))if(is_numeric($_GET["cateid"]))$cateid=$_GET["cateid"];

// 分类树
$tem=$cate->get_rows(32,'','','seq_no');
$arr_cate=array();
foreach($tem as $val){ $arr_cate[$val['id']]=$val; }
$tem=$gee->get_rows(1024,'','','seq_no');
foreach($tem as $val){
	$arr_cate[$val['category_id']]['menu'][]=$val;
}

// faq 树
$arr_faq_cate=$faq_cate->get_rows(32,'','','seq_no');

if($id==0){
	if(!isset($arr_cate[$cateid])) { header('Location:404.html'); exit; }
	$info=$arr_cate[$cateid]['menu'];
	// seo
	$cate_name=$arr_cate[$cateid]['name_'.$lang];
	$title=$cate_name.' - '.$config['SITE_TITLE_'.LANG];
	$kwd=$title;
	$dpn=$kwd;
}
else {
	$info=$gee->get_row($id);
	if(is_null($info))  { header('Location:404.html'); exit; }

	$cateid=$info['category_id'];
	$cate_name=$arr_cate[$cateid]['name_'.$lang];
	$left=$gee->get_left($id,'category_id',$cateid);
	$right=$gee->get_right($id,'category_id',$cateid);
	// seo
	$title=$info['name_'.$lang];
	$kwd=$dpn=$title;
	//$gee->click($id);
}


// view 加载视图
require VIEW.$url.'.php';

// end of file
